﻿namespace WoogiWorld.Event
{
    public delegate void EventFunction(EventMessage info);
    public class EventListener
    {
        public object listener;
        public EventFunction function;
        ~EventListener()
        {
            function = null;
        }
    }

    public class EventMessage
    {
        private EventListener target;
        private string eventType;
        private object _data;
        ~EventMessage()
        {
            _data = null;
            target = null;
        }
        public EventMessage(EventListener target, string type, object data)
        {
            this.target = target;
            this.eventType = type;
            this._data = data;
        }

        public bool CheckData()
        {
            if (_data == null)
                return false;
            return true;
        }

        public object Data
        {
            get { return _data; }
        }

        public EventListener Target
        {
            get { return target; }
        }

        public string EventType
        {
            get { return eventType; }
        }
    }
}
